A random hash function h:𝒰→{1,…,m}h: \mathcal{U} \rightarrow \{1,…,m\} is universal if, for any fixed x,y∈𝒰x,y \in \mathcal{U}, Pr[h(x)=h(y)]≤1m\mathrm{Pr}[h(x)=h(y)] \leq \frac{1}{m}
Efficient construction: Let pp be a prime number between |𝒰||\mathcal{U}| and 2|𝒰|2|\mathcal{U}|. Let aa, bb be random numbers in 0,…,p0,…,p, a≠0a \neq 0. h(x)=[a⋅x+b(modp)](modm)h(x) = [a \cdot x + b \pmod p] \pmod m is universal.
See also: Hashing Compare: Uniformly Random Hash Function